package com.gwm.page.controller;

import com.gwm.page.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;


@Controller

public class PageController {



    @Autowired
    private PageService pageService;

    @GetMapping("/item/{id}.html")
    public String showItem(@PathVariable("id") Long spuId, Model model){
        System.out.println("SPUID:"+spuId);
        Map dataMap = pageService.buildData(spuId);
        model.addAllAttributes(dataMap);
        return "item";
    }
}
